package com.helloniu.controller {

import com.helloniu.fl.NCHandler;
import com.helloniu.fl.SOHandler;
import com.helloniu.fl.util.Tool;
	
public class AbsController {
	public function AbsController() {
	}

	public function addView(view:Object):void {
		views.push(view);
	}
	
	public function updateViews():void {		
		views.forEach(forEachTest);
	}
	
	private function forEachTest(elem:*, index:int, arr:Array):void {
		try {
			elem.updateModel();
		}
		catch(e:Error) {
			Tool.alert("==abscontroller=: " + elem +"|"+ e);
		}
    }
    
    public function initConnection(ancHandler:NCHandler, asoHandler:SOHandler, auserID:String):void {
		this.ncHandler = ancHandler;
		this.soHandler = asoHandler;
		this._userID = auserID;
	}
	
	public function getModel():Object {
		return model;
	}
	
	public function getUserID():String {
		return _userID;
	}

	
	protected var model:Object;    
    
    private var views:Array = new Array();
    protected var ncHandler:NCHandler = null;
	protected var soHandler:SOHandler = null;
	protected var _userID:String = null;
	protected var inited:Boolean = false;	
}
}